<?php

class Application_Form_LoginForm extends Zend_Dojo_Form
{
	public function init()
	{
		$this->setAction('index/process');
		$this->setMethod('post');
		
		$this->setAttrib ( 'class', 'well' );
		
		$username = $this->addElement('text', 'username', array(
            'filters'    => array('StringTrim', 'StringToLower'),
            'validators' => array(
								'Alpha',
								array('StringLength', false, array(3, 20)),
							),
			'required'   => true,
			'class'      => 'input-small span3',
			'placeholder'=> 'Nombre de usuario',
            'label'      => 'Nombre de usuario:'
		));

		$password = $this->addElement('password', 'password', array(
            'filters'    => array('StringTrim'),
            'validators' => array(
								'Alnum',
								array('StringLength', false, array(6, 20)),
							),
            'required'   => true,
			'class'      => 'input-small span3',
			'placeholder'=> 'Password',
            'label'      => 'Password:'
		));

		$login = $this->addElement('submit', 'login', array(
            'required' => false,
            'ignore'   => true,
            'label'    => 'Entrar',
            'class'    => 'btn'
		));
		
		// We want to display a 'failed authentication' message if necessary;
		// we'll do that with the form 'description', so we need to add that
		// decorator.
		$this->setDecorators(array(
		'FormElements',
		array('HtmlTag', array('tag' => 'dl', 'class' => 'zend_form')),
		array('Description', array('placement' => 'prepend')),
            'Form'
		));
	}
}